<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		#btn,#button {
			width: 100px;
			height: 50px;
		}
		.box {
			margin: 50px auto;
			width: 1000px;
			display: none;
			overflow: hidden;
		}
		#box {
			width: 400px;
			height: 59px;
			margin: 50px auto;
			font-size: 30px;
			color: #fff;
			font-weight: bold;
			display: none;
		}
		#lup {
			float: left;
			width: 500px;
			height: 400px;
		}
		#lup1{
			float: right;
			width: 500px;
			height: 400px;
		}
		#m1 {
			width: 100px;
			height: 100px;
			display: none;
		}
		#sure{
			color: red;
			font-weight: bold;
		}
	</style>
</head>
<body>
			<div class="status">您当前的等级是:普通用户</div>
			<p>如果需要升级请按照步骤操作:</p>
			<p>1.支付￥20</p>
			<button id="button">微信支付</button>
			<img src="/home/music/4.jpg" id="m1">
			<p> 2.点击升级按钮</p>
			<button id="btn" >升级</button>
			<p id="sure"></p>

	<!-- 显示 -->
		


	<!-- 隐藏 -->
	<div class="box" id="box1"> 
	<img src="/home/music/1.gif" id="lup1">
	<img src="/home/music/2.gif" id="lup">
	</div>
	<div id="box">恭喜您成为超级会员!!!</div>
	<audio src="/home/music/3.mp3" id="music"></audio> 
	<form action="" method="post">
		<input type="hidden" name="id" id="id" value="{{Auth::guard('member') -> user() -> id}}"></input>
	</form>
	<script type="text/javascript" src="/home/js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		var button = document.getElementById('button');
		var btn = document.getElementById('btn');
		var sure = document.getElementById('sure');
		var m1 = document.getElementById('m1');
		var box1 = document.getElementById('box1');
		var music = document.getElementById('music');
		var box = document.getElementById('box');
		var a = '';
		var ps = document.getElementsByTagName('p');

		button.onclick = function(){
			m1.style.display = 'block';
			a = '1';
		}
		btn.onclick = function(){
			var idd = $('#id').val();
			console.log(idd);

			if (a == '1') {
				$.ajax({
					headers: { 'X-CSRF-TOKEN' : '{{ csrf_token() }}' },
					url: '/home/shenji/levelup',
					// url: '',
					type: 'POST',
					data: {id: idd},
					success: function (info) {

					}
				})

				.done(function() {
					console.log("success");
				})
				.fail(function() {
					console.log("error");
				})
				.always(function() {
					console.log("complete");
				});
				
				for (var i = 0 ; i < ps.length ; i++) {
					ps[i].style.display = 'none';
				}
				btn.style.display = 'none';
				m1.style.display = 'none';
				button.style.display = 'none';
				document.body.style.backgroundColor = 'black';
				box1.style.display = 'block';
				box.style.display = 'block';
				music.play();

				setTimeout(function(){
					location.href = '/';
				},7000)
			}else{
				sure.innerHTML="别想骗本宝宝的会员，你根本没付钱!";
			}

		};
	</script>
</body>
</html>